#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int ch = 0, flag = 0;
	while (((ch = getchar())!= '0') && ch != EOF)
	{
		if (ch == 'A')
		{
			flag++;
		}
		if (ch == 'B')
		{
			flag--;
		}
	}
	if (flag > 0)
	{
		printf("A\n");
	}
	else if (flag < 0)
	{
		printf("B\n");
	}
	else
		printf("E\n");
	return 0;
}